import request from '@/router/axios';

export const getList = (params) => {
  return request({
    url: 'api/qms/mro-repaire-out/page',
    method: 'get',
    params: {
      ...params
    }
  });
};

export const getPageList = (current, size, params) => {
  return request({
    url: 'api/mes-product/mro-repair-execute/page',
    method: 'get',
    params: {
      current,
      size,
      ...params
    }
  });
};

export const getDetail = (id) => {
  return request({
    url: 'api/mes-product/mro-repair-execute/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const getRouter = (workorderId) => {
  return request({
    url: 'api/mes-product/process/product-route/workorder-routes',
    method: 'get',
    params: {
      workorderId
    }
  });
};

export const saveRePair = (data) => {
  return request({
    url: 'api/mes-product/mro-repair-out/repair-out',
    method: 'POST',
    data
  });
};
export const repairOut = (params, row) => {
  return request({
    url: `/api/mes-product/mro/centerproduct/repair-out?${params}`,
    method: 'post',
    data: row
  });
};

export const scrap = (data) => {
  return request({
    url: '/api/mes-product/mro/centerproduct/confirm-scrap',
    method: 'post',
    data: data
  });
};

export const calculateRate = () => {
  return request({
    url: '/api/mes-product/mro/centerproduct/calculate-rate',
    method: 'get'
  });
};
